<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>门户系统</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }
        .container {
            width: 80%;
            margin: 0 auto;
            padding: 20px;
        }
        .header {
            background-color: #333;
            color: white;
            padding: 10px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .header h1 {
            margin: 0;
        }
        .user-info {
            display: flex;
            align-items: center;
        }
        .user-info span {
            margin-right: 15px;
        }
        .content {
            background-color: white;
            padding: 20px;
            margin-top: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .system-cards {
            display: flex;
            justify-content: space-around;
            margin-top: 30px;
        }
        .system-card {
            background-color: white;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            padding: 20px;
            width: 45%;
            text-align: center;
            transition: transform 0.3s ease;
        }
        .system-card:hover {
            transform: translateY(-5px);
        }
        .system-card h3 {
            margin-top: 0;
            color: #333;
        }
        .system-card p {
            color: #666;
            margin-bottom: 20px;
        }
        .btn {
            display: inline-block;
            padding: 10px 20px;
            background-color: #4285f4;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            transition: background-color 0.3s ease;
        }
        .btn:hover {
            background-color: #3367d6;
        }
        .logout-btn {
            background-color: #f44336;
        }
        .logout-btn:hover {
            background-color: #d32f2f;
        }
        .login-section {
            text-align: center;
            margin-top: 30px;
        }
        .login-btn {
            font-size: 18px;
            padding: 12px 30px;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>企业统一门户系统</h1>
        <div class="user-info" th:if="${user != null}">
            <span th:text="${'欢迎, ' + user.username}">欢迎, 用户</span>
            <a class="btn logout-btn" href="/portal/logout">退出登录</a>
        </div>
    </div>
    
    <div class="container">
        <div class="content">
            <h2>欢迎使用企业统一门户系统</h2>
            <p>通过本门户，您可以一次登录，访问企业内的多个系统。</p>
            
            <!-- 登录状态标记 -->
            <div th:if="${user != null}" style="background-color: #dcfce7; color: #16a34a; padding: 10px; border-radius: 5px; margin-top: 15px; margin-bottom: 20px; font-weight: bold; border: 1px solid #16a34a; display: inline-block;">
                <span style="font-size: 16px;">✅ 当前状态：已登录</span>
            </div>
            <div th:if="${user == null}" style="background-color: #fee2e2; color: #dc2626; padding: 10px; border-radius: 5px; margin-top: 15px; margin-bottom: 20px; font-weight: bold; border: 1px solid #dc2626; display: inline-block;">
                <span style="font-size: 16px;">❌ 当前状态：未登录</span>
            </div>
            
            <!-- 已登录用户显示系统卡片 -->
            <div class="system-cards" th:if="${user != null}">
                <div class="system-card">
                    <h3>OA系统</h3>
                    <p>企业办公自动化系统，处理日常办公事务</p>
                    <a class="btn" th:href="${oaSystemUrl}">进入OA系统</a>
                </div>
                
                <div class="system-card">
                    <h3>风控系统</h3>
                    <p>企业风险控制系统，管理企业风险</p>
                    <a class="btn" th:href="${riskControlSystemUrl}">进入风控系统</a>
                </div>
            </div>
            
            <!-- 未登录用户显示登录按钮 -->
            <div class="login-section" th:if="${user == null}">
                <p>请登录以访问企业内部系统</p>
                <a class="btn login-btn" href="/portal/login">立即登录</a>
            </div>
        </div>
    </div>
</body>
</html>